package com.vvlive.caibao.smartcity.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.vvlive.caibao.smartcity.bean.LifeOrderMealEatCateBean;

import java.util.List;

import smartcity.vvlive.caibao.com.smartc.R;

/**
 * Created by lenovo on 2015/6/29.
 * 用于外卖确认提交订单页,外卖订单详情页
 */
public class LifeSubmitEatOrderAdapter extends BaseAdapter{
    Context mContext;
    List<LifeOrderMealEatCateBean> mList;

    public LifeSubmitEatOrderAdapter(Context context, List<LifeOrderMealEatCateBean> mList) {
        mContext = context;
        this.mList = mList;
    }

    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int position) {
        return mList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder vh;
        if(convertView == null){
            convertView = LayoutInflater.from(mContext).inflate(R.layout.life_item_submit_eat_orders_list,null);
            vh = new ViewHolder();
            vh.mName = (TextView) convertView.findViewById(R.id.item_submit_eat_orders_list_name);
            vh.jige = (TextView) convertView.findViewById(R.id.item_submit_eat_orders_list_num);
            vh.jiage = (TextView) convertView.findViewById(R.id.item_submit_eat_orders_list_money);
            convertView.setTag(vh);
        }else{
            vh = (ViewHolder) convertView.getTag();
        }
        vh.mName.setText(mList.get(position).getName());
        vh.jige.setText("1");
        vh.jiage.setText("价格:"+mList.get(position).getPrice());
        return convertView;
    }
    class ViewHolder{
        TextView mName;
        TextView jige;
        TextView jiage;
    }
}
